/**
 * @author Andrew Dashin <dashin@andrewdashin.com>
 */

var MyAbout = Class.create();
MyAbout.prototype = Object.extend(new JTKWindow(), {
	instance: null,
	/*
	 * This is constructor of About Box;
	 * @constructor
	 * @base JTKWindow
	 */
	initialize: function () {
		if (MyAbout.prototype.instance == null) {
			MyAbout.prototype.instance = this;
			var oThis = this;
	        this.bar = new JTKDraggableBar(i18n("about.title.text"));
			this.bar.setClass('MyDraggableBar');
			this.setClass('MyAbout');
			this.close = new JTKImg();
			this.close.setImage('img/close.gif');
			this.bar.show(this);
			this.close.show(this.bar);
			this.close.setOnClick(function () {
				// do not dispose it - just hide.
				oThis.setVisibility(false);
			});
			this.pane = new JTKWidget();
			this.pane.setInnerHTML('Google SoC 2007 <br/><a href="http://andrewdashin.com/">Andrew Dashin</a><br /><a href="mailto:dashin@andrewdashin.com">dashin@andrewdashin.com</a>');
			this.setVisibility(false);
			this.pane.show(this);
			this.show($('pane'));
		} else {
			var oThis = MyAbout.prototype.instance;
		}

		if (!oThis.visible()) {
			oThis.setPosition(new JTKPoint(Math.round((document.body.clientWidth / 2) - (_parseInt(oThis.getStyle("width")) / 2)), 20));
			oThis.setVisibility(true);
		}
		return MyAbout.prototype.instance;
	},
	/*
	 * This is class destructor
	 */
	dispose: function () {
		JTKWidget.prototype.dispose.call(this);
	}
});
